﻿<div class="ph-tabs">
    <ul>
        <li class="k-state-active">身高和体重评分标准</li>
    </ul>
    <div>
        <div class="k-block divToolbar">
            <div style="display:inline-block; ">
                <b>年级：</b><select id="selGrade"></select>
            </div>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <div style="display:inline-block;">
                <b>姓别：</b>
                <select id="selSex">
                    <option value="0" selected="selected">全部</option>
                    <option value="1">男</option>
                    <option value="2">女</option>
                </select>
            </div>
        </div>
        <div id="grid_ehaw" style="text-align: center"></div>
    </div>
</div>

<script class="init">
    LocatedMenu("国家标准", "身高和体重");

    $("#selGrade").kendoDropDownList({
        optionLabel: {
            GradeName: "请选择年级",
            Code: 0
        },
        dataTextField: "GradeName",
        dataValueField: "Code",
        dataSource: Whale.dataSource({
            url: "/School/Config/GetGrades"
        }),
        change: function (e) {
            Filter();
        }
    })
    $("#selSex").kendoDropDownList({
        change: function (e) { Filter(); }
    });
</script>

<script class="grid_ehaw_columns">
    var fields = [{
        title: "年级",
        field: "GradeCode",
        template: "#=GetGradeString(GradeCode)#",
        width: 120
    }, {
        title: "性别",
        field: "Sex",
        template: "#=GetSexString(Sex)#",
        width: 80
    }, {
        title: "身高（厘米）",
        template: "#=HeightMin# -- #=HeightMax# ",
        width: 120
    }, {
        title: "体重（公斤）",
        template: "#=WeightMin# -- #=WeightMax#",
        width: 120
    }, {
        title: "得分",
        field:"Score",
        width: 80
    }, {
        title: "身体状况",
        field: "Description",
        width: 120
    }, {}];

    var i = 0;
    function ShowSerialNo() {
        i++;
        var p = $("#grid_ehaw").data("kendoGrid").dataSource().page() - 1;
        return p * 20 + i;
    }
</script>

<script class="grid_config">
    $(function () {
        $("#grid_ehaw").kendoGrid({
            columns: fields,
            dataSource: Whale.dataSource({
                url: "/Standard/Evaluation/GetEhaws",
                getParameters: function () {
                    var gradeCode = $("#selGrade").data("kendoDropDownList").value();
                    if (gradeCode == "") gradeCode = 0;
                    return {
                        gradeCode: gradeCode,
                        sex: $("#selSex").data("kendoDropDownList").value()
                    }
                },
                pageSize: 20
            }),
            pageable: {
                messages: {
                    empty: "暂无数据"
                }
            },
            dataBound: function (e) {
                //让表头居中
                $("th.k-header").attr("style", "text-align:center; font-weight:bold;");
            }
        });
    });

    function Filter() {
        $("#grid_ehaw").data("kendoGrid").dataSource.page(0);
    }
</script>
